<template>
	<view class="myAgent-container">
		<view class="top">
			<view class="bold mb20 center">
				当前属性: {{level[agentLevel]}}
			</view>
			<!-- 总代 -->
			<view v-if="agentLevel==0">
				<view class="bold mb20 center">
					二级代理人数:10，一级代理人数:30
				</view>
				<view class="bold mb20 center">
					已获得佣金:XXXX，昨日佣金:XXXXX，当前余额:XXXX
				</view>
			</view>
			<!-- 一级代理 -->
			<view v-if="agentLevel==1">
				<view class="bold mb20 center">
					游戏会员数:10
				</view>
				<view class="bold mb20 center">
					已获得佣金:XXXX，昨日佣金:XXXXX，当前余额:XXXX
				</view>
			</view>
			<!-- 二级代理 -->
			<view v-if="agentLevel==2">
				<view class="bold mb20 center">
					一级代理人数:30，游戏会员数:10
				</view>
				<view class="bold mb20 center">
					已获得佣金:XXXX，昨日佣金:XXXXX，当前余额:XXXX
				</view>
			</view>

		</view>
		<!-- tabs -->
		<view class="" v-if="agentLevel!=1">
			<tui-tabs class="mb40" :tabs="tabs" :currentTab="currentTab" @change="change"></tui-tabs>

			<uni-table ref="table" v-if="currentTab==0" border stripe emptyText="暂无更多数据">
				<uni-tr>
					<uni-th width="90" align="center">玩家ID</uni-th>
					<uni-th width="90" align="center">注册时间</uni-th>
					<uni-th width="110" align="center">最后登录时间</uni-th>
					<uni-th width="90" align="center">联系方式</uni-th>
					<uni-th width="110" align="center">主要参与游戏</uni-th>
					<uni-th width="100" align="center">游戏总计有效投注</uni-th>
					<uni-th width="90" align="center">昨日有效投入</uni-th>
				</uni-tr>
				<uni-tr v-for="(item, index) in table" :key="index">
					<uni-td align="center">{{ item.num }}</uni-td>
					<uni-td align="center">{{ item.gold }}</uni-td>
					<uni-td align="center">{{ item.rate }}</uni-td>
				</uni-tr>
			</uni-table>

		</view>
	</view>
</template>

<script>
		import {actingList} from '@/api/user.js'
	export default {
		data() {
			return {
				agentLevel: 0,
				table: [],
				level: {
					0: '总代',
					1: '一级代理',
					2: '二级代理',
				},
				showModal: false,
				currentTab: 0,
				tabs: [{
					name: "游戏会员"
				}, {
					name: "一级代理"
				}, {
					name: "二级代理"
				}]
			};
		},
		onShow() {
			this.getActingList()
			switch (this.agentLevel) {
				// 总代
				case 0:
					this.tabs = [{
						name: "游戏会员"
					}, {
						name: "一级代理"
					}, {
						name: "二级代理"
					}]
					break;
					// 二级代理
				case 2:
					this.tabs = [{
						name: "游戏会员"
					}, {
						name: "一级代理"
					}]
					break;

			}
		},
		methods: {
			getActingList(){
				actingList(res=>{
					console.log(66,res);
				})
			},
			onNavigationBarButtonTap(e) {
				if (false) {
					this.showModal = true
				} else {
					uni.navigateTo({
						url: '/pages/user/agent/myAgent'
					})
				}

			},
			//切换tab，逻辑请自行处理
			change(e) {
				this.currentTab = e.index
				console.log(111, e);
			}
		}
	}
</script>

<style lang="scss">
	.myAgent-container {
		padding: 20rpx;
		color: var(--txt-color-black);

	}
</style>